<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    div {
      float: left;
      width: 400px;
      height: 400px;
      border: 5px gray solid;
      background-image: url(../image/image/1.jpg);
      background-repeat: no-repeat;
      background-position: center;
      color: white;
      line-height: 400px;
      text-align: center;
      font-size: 20px;
    }

    #div1 {
      background-size: 100% 100%;
    }

    #div2 {
      background-size: cover;
    }

    #div3 {
      background-size: contain;
    }
  </style>
</head>

<body>
  <div id="div1">拉伸效果</div>
  <div id="div2">不变形撑满空间，只显示部分空间</div>
  <div id="div3">不变形显示整个图片，容器有剩余</div>
</body>

</html>